package com.congee02.aop.proxy.nondynamic;

import com.congee02.aop.service.UserService;

/**
 * @author congee(congee02 @ 163.com)
 * @date 1/26/2023 1:36 PM
 */
public class UserServiceNotifyStaticProxy implements UserService {

    private final String FLAG = "{NOTIFIED}";
    private final UserService service;

    public UserServiceNotifyStaticProxy(UserService service) {
        this.service = service;
    }

    @Override
    public String save(String username) {
        String message = service.save(username);
        System.out.println("notifying {saving user "+ username +"}");
        return message + FLAG;
    }

    @Override
    public void printObjectAddress() {
        System.out.println(this);
    }
}
